//
//  KLMainTableViewCell.m
//  Koala
//
//  Created by cao pan on 11/22/14.
//  Copyright (c) 2014 Anonymous. All rights reserved.
//

#import "KLMainTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation KLMainTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
       self = [[[NSBundle mainBundle] loadNibNamed:@"KLMainTableViewCell" owner:self options:nil] objectAtIndex:0] ;
    }
    return self;
}


- (void)awakeFromNib
{

}


- (void) updateByMainModel:(KLMainDataModel *)mainDataModel
{
    NSLog(@"--------------------------- %@ \n %@",
          mainDataModel.titleStr,
          mainDataModel.imageUrl);
    UILabel * testLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 5, 230, 40)];
    [testLabel setText:mainDataModel.titleStr];
    [testLabel setTextColor:[UIColor blackColor]];
    [testLabel setFont:[UIFont systemFontOfSize:17]];
    [testLabel setNumberOfLines:2];
    [testLabel sizeToFit];
    [self.contentView addSubview:testLabel];
    
    
    UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 50, 50)];
    [self.contentView addSubview:imageView];
    
    [imageView sd_setImageWithURL:[NSURL URLWithString:mainDataModel.imageUrl] placeholderImage:[UIImage imageNamed:@"logo57"]];
}

+ (CGFloat)heightOfMainTableViewCell
{
    return 60;
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    
    [super setSelected:selected animated:animated];
}

@end
